home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / dos / freedosobject.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  99 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: freedosobject.c,v 1.4 1996/10/24 15:50:30 aros Exp $
  4.     $Log: freedosobject.c,v $
  5.     Revision 1.4  1996/10/24 15:50:30  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.3  1996/08/13 13:52:47  digulla
  9.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  10.     Replaced AROS_LA by AROS_LHA
  11.  
  12.     Revision 1.2  1996/08/01 17:40:52  digulla
  13.     Added standard header for all files
  14.  
  15.     Desc:
  16.     Lang: english
  17. */
  18. #include <exec/memory.h>
  19. #include <clib/exec_protos.h>
  20. #include <dos/exall.h>
  21. #include "dos_intern.h"
  22.  
  23. /*****************************************************************************
  24.  
  25.     NAME */
  26.     #include <clib/dos_protos.h>
  27.  
  28.     AROS_LH2(void, FreeDosObject,
  29.  
  30. /*  SYNOPSIS */
  31.     AROS_LHA(ULONG, type, D1),
  32.     AROS_LHA(APTR,  ptr,  D2),
  33.  
  34. /*  LOCATION */
  35.     struct DosLibrary *, DOSBase, 39, Dos)
  36.  
  37. /*  FUNCTION
  38.     Frees an object allocated with AllocDosObject.
  39.  
  40.     INPUTS
  41.     type - object type. The same parameter as given to AllocDosObject().
  42.     ptr  - Pointer to object.
  43.  
  44.     RESULT
  45.  
  46.     NOTES
  47.  
  48.     EXAMPLE
  49.  
  50.     BUGS
  51.  
  52.     SEE ALSO
  53.  
  54.     INTERNALS
  55.  
  56.     HISTORY
  57.     29-10-95    digulla automatically created from
  58.                 dos_lib.fd and clib/dos_protos.h
  59.  
  60. *****************************************************************************/
  61. {
  62.     AROS_LIBFUNC_INIT
  63.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  64.  
  65.     switch(type)
  66.     {
  67.     case DOS_FILEHANDLE:
  68.     {
  69.         struct FileHandle *fh=(struct FileHandle *)ptr;
  70.         if(fh->fh_Flags&FHF_BUF)
  71.         FreeMem(fh->fh_Buf,fh->fh_Size);
  72.         FreeMem(fh,sizeof(struct FileHandle));
  73.         break;
  74.     }
  75.     case DOS_FIB:
  76.         FreeMem(ptr,sizeof(struct FileInfoBlock));
  77.         break;
  78.     case DOS_EXALLCONTROL:
  79.         FreeMem(ptr,sizeof(struct ExAllControl));
  80.         break;
  81.     case DOS_CLI:
  82.     {
  83.         struct CommandLineInterface *cli=(struct CommandLineInterface *)ptr;
  84.         BPTR *cur, *next;
  85.         cur=(BPTR *)BADDR(cli->cli_CommandDir);
  86.         FreeMem(ptr,sizeof(struct CommandLineInterface));
  87.         while(cur!=NULL)
  88.         {
  89.         next=(BPTR *)BADDR(cur[0]);
  90.         UnLock(cur[1]);
  91.         FreeVec(cur);
  92.         cur=next;
  93.         }
  94.         break;
  95.     }
  96.     }
  97.     AROS_LIBFUNC_EXIT
  98. } /* FreeDosObject */
  99.